home *** CD-ROM | disk | FTP | other *** search
/ Inside Multimedia 1994 April / Inside Multimedia CD-ROM (April 1994).iso / prg / gs / gs250.exe / GS_INIT.PS < prev    next >
Encoding:
Text File  |  1992-09-03  |  27.7 KB  |  912 lines

  1. %    Copyright (C) 1989, 1992 Aladdin Enterprises.  All rights reserved.
  2. %    Distributed by Free Software Foundation, Inc.
  3. %
  4. % This file is part of Ghostscript.
  5. %
  6. % Ghostscript is distributed in the hope that it will be useful, but
  7. % WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. % to anyone for the consequences of using it or for whether it serves any
  9. % particular purpose or works at all, unless he says so in writing.  Refer
  10. % to the Ghostscript General Public License for full details.
  11. %
  12. % Everyone is granted permission to copy, modify and redistribute
  13. % Ghostscript, but only under the conditions described in the Ghostscript
  14. % General Public License.  A copy of this license is supposed to have been
  15. % given to you along with Ghostscript so you can know your rights and
  16. % responsibilities.  It should be in a file named COPYING.  Among other
  17. % things, the copyright notice and this notice must be preserved on all
  18. % copies.
  19.  
  20. % Initialization file for Ghostscript.
  21. % When this is run, systemdict is still writable.
  22.  
  23. % Acquire the debugging flags.
  24. currentdict /DEBUG known   /DEBUG exch def
  25.   /VMDEBUG
  26.     DEBUG {{print ( ) print vmstatus pop (      ) cvs print pop ( ) print
  27.             systemdict length (      ) cvs print (\n) print flush}}
  28.       {{pop}} ifelse
  29.   def
  30. currentdict /DISKFONTS known   /DISKFONTS exch def
  31. currentdict /ESTACKPRINT known   /ESTACKPRINT exch def
  32. currentdict /NOBIND known   /NOBIND exch def
  33. /.bind /bind load def
  34. NOBIND { /bind { } def } if
  35. currentdict /NOCACHE known   /NOCACHE exch def
  36. currentdict /NODISPLAY known   not /DISPLAYING exch def
  37. currentdict /NOPAUSE known   /NOPAUSE exch def
  38. currentdict /OUTPUTFILE known    % obsolete
  39.  { /OutputFile /OUTPUTFILE load def
  40.    currentdict /OUTPUTFILE undef
  41.  } if
  42. currentdict /QUIET known   /QUIET exch def
  43. currentdict /SAFER known   /SAFER exch def
  44. currentdict /WRITESYSTEMDICT known   /WRITESYSTEMDICT exch def
  45.  
  46. % Acquire environment variables.
  47. currentdict /DEVICE known not
  48.  { (GS_DEVICE) getenv { /DEVICE exch def } if } if
  49.  
  50. QUIET not { (Initializing... ) print flush } if
  51.  
  52. % Acquire systemdict and userdict.
  53. % Note that the dictionary stack only has 1 element at this point!
  54. /systemdict currentdict def
  55. % Figure out whether we have 2 or 3 permanent dictionaries.
  56. 0 dict begin
  57. 0 dict begin
  58. cleardictstack
  59. currentdict dup 200 setmaxlength        % userdict
  60. systemdict begin
  61. /userdict exch def
  62.  
  63. (START) VMDEBUG
  64.  
  65. % Define true and false.
  66. /true 0 0 eq def
  67. /false 0 1 eq def
  68.  
  69. % Acquire the standard files.
  70. /.stdin (%stdin) (r) file def
  71. /.stdout (%stdout) (w) file def
  72. /.stderr (%stderr) (w) file def
  73.  
  74. % Turn on array packing for the rest of initialization.
  75. true setpacking
  76.  
  77. % Define a special version of def for making operator procedures.
  78. /odef
  79.     {1 index exch makeoperator def} bind def
  80.  
  81. % Define predefined procedures substituting for operators,
  82. % in alphabetical order.
  83.  
  84. userdict /#copies 1 put
  85. /[    /mark load def
  86. /]     {counttomark array astore exch pop} odef
  87. /abs    {dup 0 lt {neg} if} odef
  88. /copypage
  89.     { 1 false .outputpage
  90.       (>>copypage, press <return> to continue<<\n) .confirm
  91.     } odef
  92. /defaultmatrix
  93.     {currentdevice exch deviceinitialmatrix} odef
  94. /.echo /echo load def
  95. userdict /.echo.mode true put
  96. /echo    {dup /.echo.mode exch store .echo} odef
  97. /eexec
  98.     { 55665 .filtereexecDecode
  99.       cvx systemdict begin stopped end {stop} if
  100.     } bind def
  101. /executive
  102.     { { prompt (%statementedit) (r) file
  103.         dup bytesavailable 0 lt
  104.          { .stdin bytesavailable 0 lt {closefile exit} if }
  105.         if cvx execute
  106.       } loop
  107.     } odef
  108. /framedevice
  109.     {.stderr (Warning: framedevice is an obsolete operator.\n) writestring
  110.      .stderr flushfile
  111.      pop pop pop setmatrix initclip} odef
  112. % The "revision" is the Ghostscript release number x 100 + the sub-release.
  113. /gsrevision 250 def
  114. /gsrevisiondate
  115.     (8/18/92) def
  116. /handleerror
  117.     {errordict /handleerror get exec} bind def
  118. /identmatrix
  119.     {{1.0 0.0 0.0 1.0 0.0 0.0} cvlit exch copy} odef
  120. /initgraphics
  121.     {initmatrix newpath initclip 1 setlinewidth 0 setlinecap 0 setlinejoin
  122.      [] 0 setdash 0 setgray 10 setmiterlimit} odef
  123. /initmatrix
  124.     {.tempmatrix defaultmatrix setmatrix} odef
  125. /languagelevel
  126.     1 def
  127. /matrix    {6 array identmatrix} odef
  128. /prompt    {flush flushpage
  129.      (GS) print count 0 ne
  130.       {(<) print count =only}
  131.      if (>) print flush} bind def
  132. /pstack    {0 1 count 3 sub {index ==} for} def
  133. /quit    {0 .quit} odef
  134. /revision gsrevision def
  135. /run    {dup type /filetype eq
  136.       { true }
  137.       { findlibfile { exch pop true } { false } ifelse }
  138.      ifelse
  139.       {cvx execute}
  140.       {(r) file}        % let the error happen
  141.      ifelse} odef
  142. /showpage
  143.     { #copies true .outputpage
  144.       (>>showpage, press <return> to continue<<\n) .confirm
  145.       erasepage initgraphics
  146.     } odef
  147. % Code output by Adobe Illustrator relies on the fact that
  148. % `stack' is a procedure, not an operator!!!
  149. /stack    {0 1 count 3 sub {index =} for} bind def
  150. /start    { QUIET not
  151.       {(Ghostscript ) print gsrevision 10 idiv 10 div =only
  152.        gsrevision 10 mod dup 0 ne { (.) print =only } { pop } ifelse
  153.        ( \() print gsrevisiondate print (\)\n) print
  154.        (  Copyright (C) 1990, 1992 Aladdin Enterprises, Menlo Park, CA.\n) print
  155.        (  All rights reserved.\n) print
  156.        (Distributed by Free Software Foundation, Inc.\n) print
  157.        (Ghostscript comes with NO WARRANTY: see the file LICENSE for details.\n) print
  158.        flush
  159.       } if
  160.       executive
  161.     } def
  162. % Ghostscript is compatible with PostScript "version" 54.0 (I think).
  163. /version (54.0) def
  164.  
  165. % Provide semi-fake but usable definitions for
  166. % the color PostScript extensions (except for colorimage,
  167. % which is actually implemented as an operator, and
  168. % setcmykcolor and currentcmykcolor, which must be operators
  169. % to interact properly with setcolor and currentcolor).
  170. /setblackgeneration {
  171.     pop
  172. } odef
  173. /currentblackgeneration {
  174.     {}
  175. } odef
  176. /setundercolorremoval {
  177.     pop
  178. } odef
  179. /currentundercolorremoval {
  180.     {pop 0}
  181. } odef
  182. /setcolorscreen {
  183.     setscreen 9 {pop} repeat
  184. } odef
  185. /currentcolorscreen {
  186.     currentscreen 3 copy 6 copy
  187. } odef
  188.  
  189. % Define the filter dictionary and operator.
  190.  
  191. /.filterdict mark
  192.     /ASCII85Encode /.filterASCII85Encode
  193.     /ASCII85Decode /.filterASCII85Decode
  194.     /ASCIIHexEncode /.filterASCIIHexEncode
  195.     /ASCIIHexDecode /.filterASCIIHexDecode
  196.     /CCITTFaxEncode /.filterCCITTFaxEncode
  197.     /CCITTFaxDecode /.filterCCITTFaxDecode
  198.     /eexecDecode /.filtereexecDecode
  199.     /LZWEncode /.filterLZWEncode
  200.     /LZWDecode /.filterLZWDecode
  201.     /NullEncode /.filterNullEncode
  202.     /PFBDecode /.filterPFBDecode
  203.     /RunLengthEncode /.filterRunLengthEncode
  204.     /RunLengthDecode /.filterRunLengthDecode
  205.     /SubFileDecode /.filterSubFileDecode
  206.     counttomark 2 idiv
  207.     dup dict begin
  208.      { dup where { pop load def } { pop pop } ifelse } repeat
  209.     pop
  210. currentdict end def
  211. /filter
  212.     { //.filterdict exch get exec
  213.     } odef
  214.  
  215. % Define procedures for getting and setting the current device resolution.
  216.  
  217. /gsgetdeviceprop
  218.  { 1 index getdeviceprops
  219.     { 1 index counttomark 1 add index eq { exit } if pop pop } loop
  220.    dup mark eq        % if true, not found
  221.     { pop dup /undefined signalerror }
  222.     { counttomark 1 add 1 roll cleartomark exch pop exch pop }
  223.    ifelse
  224.  } bind def
  225. /gscurrentresolution
  226.  { currentdevice /HWResolution gsgetdeviceprop
  227.  } bind def
  228. /gssetresolution
  229.  { 2 array astore mark exch /HWResolution exch
  230.    currentdevice copydevice putdeviceprops setdevice
  231.  } bind def
  232.  
  233. % Define a few Level 2 operators that are needed by other things in
  234. % the initialization files. 
  235.  
  236. /dicttomark        % (the Level 2 >> operator)
  237.     { counttomark 2 idiv dup dict begin
  238.        { def } repeat pop currentdict end
  239.     } bind def
  240.  
  241. (<<) cvn /mark load def
  242. (>>) cvn /dicttomark load odef
  243. /deviceinfo { getdeviceprops dicttomark } odef
  244.  
  245. % Define simplified versions of the composite font operators
  246. % that work with (and only with) non-composite fonts.
  247.  
  248. /.encodingdict 3 dict
  249.     dup /StandardEncoding /StandardEncoding cvx put
  250.     dup /ISOLatin1Encoding /ISOLatin1Encoding cvx put
  251.     dup /SymbolEncoding /SymbolEncoding cvx put
  252.     def
  253. /cshow
  254.     { exch 1 string
  255.        { dup 0 4 index put stringwidth 3 -1 roll exec }
  256.       /exec cvx 4 array astore cvx
  257.       forall
  258.     } odef
  259. /findencoding
  260.     { //.encodingdict exch get exec } odef
  261. /rootfont
  262.     { currentfont } odef
  263. /setcachedevice2
  264.     { pop pop pop pop setcachdevice } odef
  265.  
  266. % Define some additional built-in procedures (beyond the ones defined by
  267. % the PostScript Language Reference Manual).
  268.  
  269. /concatprocs
  270.     { exch cvlit exch cvlit        % proc1 proc2
  271.       dup length 2 index length add array    % proc1 proc2 newproc
  272.       dup 0 4 index putinterval
  273.       dup 3 index length 3 index putinterval
  274.       exch pop exch pop cvx
  275.     } bind def
  276. /concatstrings
  277.     { 1 index length 1 index length add string
  278.       2 index 1 index copy pop
  279.       dup 3 index length 3 index length getinterval
  280.       2 index exch copy pop
  281.       exch pop exch pop
  282.     } bind def
  283. /copyarray
  284.     { dup length array copy } bind def
  285. /copystring
  286.     { dup length string copy } bind def
  287. /defaultdevice
  288.     { systemdict /DEVICE known
  289.        { systemdict /DEVICE get finddevice }
  290.        { 0 getdevice }
  291.       ifelse
  292.     } bind def
  293. /finddevice
  294.     { systemdict /devicedict get exch get } bind def
  295. /selectdevice
  296.     { finddevice setdevice } bind def
  297. /signalerror        % object errorname
  298.     { errordict exch get exec } bind def
  299.  
  300. % Define auxiliary procedures needed for the above.
  301. /shellarguments        % -> shell_arguments true (or) false
  302.     { /ARGUMENTS where
  303.        { /ARGUMENTS get dup type /arraytype eq
  304.           { aload pop /ARGUMENTS null store true }
  305.           { pop false }
  306.          ifelse }
  307.        { false } ifelse
  308.     } bind def
  309. /.confirm
  310.     {DISPLAYING NOPAUSE not and
  311.       {% Print a message and wait for the user to type something.
  312.        % If the user just types a newline, flush it.
  313.        print flush
  314.        .echo.mode false echo
  315.          .stdin dup read
  316.          {dup (\n) 0 get eq {pop pop} {unread} ifelse} {pop} ifelse
  317.        echo}
  318.       {pop} ifelse} bind def
  319. /.identmatrix        % a read-only identity matrix
  320.     matrix readonly def
  321. /.tempmatrix        % a temporary matrix
  322.     matrix def
  323.  
  324. % Define the procedure used by the C executive for executing user input,
  325. % and also by the run operator.
  326. % This is called with a procedure or file on the operand stack.
  327. /execute
  328.     {stopped $error /newerror get and {handleerror} if} odef
  329.  
  330. % Define a special version of `run' that aborts on errors.
  331. /run0
  332.     { dup /.currentfilename exch def
  333.        { findlibfile not { stop } if }
  334.       stopped
  335.        { (Can't find initialization file ) print
  336.          .currentfilename
  337.          /== where { pop == } { = } ifelse
  338.          flush 1 .quit
  339.        } if
  340.       exch pop cvx stopped
  341.        { (While reading ) print .currentfilename print (:\n) print flush
  342.          handleerror 1 .quit
  343.        } if
  344.     } bind def
  345. % Temporarily substitute it for the real `run'.
  346. /.run /run load def
  347. /run /run0 load def
  348.  
  349. % If we want a "safer" system, disable some obvious ways to cause havoc.
  350. SAFER
  351.  {    /file
  352.      { dup (r) eq
  353.         { file }
  354.         { /invalidfileaccess signalerror }
  355.        ifelse
  356.      } bind odef
  357.     /renamefile { /invalidfileaccess signalerror } odef
  358.     /deletefile { /invalidfileaccess signalerror } odef
  359.  }
  360. if
  361.  
  362. % Create the error handling machinery.
  363. % The interpreter has created the ErrorNames array.
  364. % Define $error.
  365. /$error 11 dict def        % newerror, errorname, command, errorinfo,
  366.                 % ostack, estack, dstack, recordstacks,
  367.                 % binary, .inerror, position
  368. $error begin
  369.   /newerror false def
  370.   /recordstacks true def
  371.   /binary false def
  372.   /.inerror false def
  373. end
  374. % Define errordict.  It has one entry per error name, plus handleerror.
  375. /errordict ErrorNames length 1 add dict def
  376. % Define the standard error handlers.  When they are invoked,
  377. % the top element of the o-stack is the error name;
  378. % the next element is the offending command.
  379. errordict begin
  380.   { //$error /.inerror get .instopped not or
  381.      { (Unrecoverable error: ) print =only flush
  382.        ( in ) print = flush
  383.        count 0 gt
  384.         { (Operand stack:\n  ) print
  385.       0 1 count 3 sub { (  ) print index =only flush } for
  386.       (\n) print flush
  387.     } if
  388.        1 .quit
  389.      } if    % detect error recursion
  390.     $error /.inerror true put
  391.     $error /newerror true put
  392.     $error exch /errorname exch put
  393.     $error exch /command exch put
  394.     $error /dstack undef
  395.     $error /estack undef
  396.     $error /ostack undef
  397.     $error /recordstacks get $error /errorname get /VMerror ne and
  398.      { $error /dstack countdictstack array dictstack put
  399.        $error /estack countexecstack array execstack put
  400.        count array astore dup $error exch /ostack exch put
  401.      aload pop
  402.      } if
  403.     $error /.inerror false put
  404.     stop
  405.   } bind
  406.   ErrorNames
  407.    { [ 1 index 3 index /exec load ] cvx def
  408.    } forall
  409.   pop
  410. end
  411. % Define the standard handleerror.
  412. errordict begin
  413.   /handleerror
  414.    { (Error: ) print
  415.      $error begin
  416.        errorname ==only flush
  417.        ( in ) print
  418.        /command load ==only flush
  419.        currentdict /ostack known
  420.         { (\nOperand stack:\n  ) print ostack { (  ) print ==only } forall
  421.     } if
  422.        currentdict /estack known
  423.         { (\nExecution stack:\n  ) print
  424.       estack { (  ) print ESTACKPRINT { ==only } { =only } ifelse } forall
  425.     } if
  426.        currentdict /dstack known
  427.     { (\nDictionary stack:\n  ) print dstack
  428.        { dup (  ) print length =only (/) print maxlength =only } forall
  429.     } if
  430.        (\n) print
  431.        errorname /VMerror eq
  432.         { (VM status:) print mark vmstatus
  433.       counttomark { ( ) print counttomark -1 roll dup =only } repeat
  434.       cleartomark (\n) print
  435.     } if
  436.        /newerror false def
  437.      end
  438.      currentdict /position known
  439.       { (Current file position is ) print position = }
  440.      if
  441.      flush
  442.      .instopped {stop} if
  443.    } bind def
  444. end
  445.  
  446. % Define the =[only] procedures.  Also define =print and =string,
  447. % which are used by some P*stScr*pt programs even though
  448. % they aren't documented anywhere.
  449. /=print    {=only} def
  450. /=string 128 string def
  451. /=    {=only (\n) print} bind def
  452. 4 dict begin
  453.   /.buf =string def
  454.   /.print
  455.     {dup type currentdict exch known
  456.      {dup type exec} {.buf cvs print} ifelse
  457.     } bind def
  458.   /stringtype
  459.     {dup rcheck not {pop (--nostringval--)} if print} bind def
  460.   /nametype
  461.     {dup length .buf length gt
  462.      {dup length string}
  463.      {.buf}
  464.     ifelse cvs print} bind def
  465. {0 begin .print end} copyarray dup 0 currentdict put
  466.   cvx bind
  467. end
  468. /=only exch def
  469.  
  470. % Define the [write]==[only] procedures.
  471. /==    {==only (\n) print} bind def
  472. /==only    {.stdout exch write==only} bind def
  473. /write==
  474.     {2 copy write==only pop (\n) writestring} bind def
  475. /.dict 18 dict dup
  476. begin def
  477.   /.buf 128 string def
  478.   /.cvp {.buf cvs .p} bind def
  479. % /.f {the_output_file} def
  480.   /.nop {(-) .p type .cvp (-) .p} bind def
  481.   /.p {.f exch writestring} bind def
  482.   /.p1 {.f exch write} bind def
  483.   /.print
  484.     {dup type .dict exch known
  485.      {dup type exec} {.nop} ifelse
  486.     } bind def
  487.   /integertype /.cvp load def
  488.   /nulltype { pop (null) .p } bind def
  489.   /realtype /.cvp load def
  490.   /booleantype /.cvp load def
  491.   /nametype
  492.     {dup xcheck not {(/) .p} if
  493.      dup length .buf length gt
  494.       {dup length string}
  495.       {.buf}
  496.      ifelse cvs .p} bind def
  497.   /arraytype
  498.     {dup rcheck
  499.       {dup xcheck {(})({)} {(])([)} ifelse .p
  500.        exch () exch
  501.        {exch .p .print ( )} forall pop .p}
  502.       {.nop}
  503.      ifelse} bind def
  504.   /operatortype
  505.       {(--) .p .cvp (--) .p} bind def
  506.   /packedarraytype /arraytype load def
  507.   /stringtype
  508.     {dup rcheck
  509.       {(\() .p
  510.        {/.ch exch def
  511.         .ch 32 lt .ch 127 ge or
  512.         {(\\) .p .ch 8#1000 add 8 .buf cvrs 1 3 getinterval .p}
  513.         {.ch 40 eq .ch 41 eq or .ch 92 eq or
  514.          {(\\) .p} if
  515.          .ch .p1}
  516.         ifelse}
  517.        forall (\)) .p}
  518.       {.nop}
  519.      ifelse} bind def
  520. {0 begin exch cvlit /.f exch def .print end} copyarray dup 0 .dict put
  521.   bind cvx
  522. end
  523. /write==only exch def
  524.  
  525. (END PROCS) VMDEBUG
  526.  
  527. % Define the font directory.
  528. % Make it big to leave room for transformed fonts.
  529. /FontDirectory 100 dict def
  530.  
  531. % Define the standard encoding vector.
  532. /StandardEncoding
  533. % \00x
  534.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  535.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  536.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  537.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  538. % \04x
  539.     /space /exclam /quotedbl /numbersign
  540.     /dollar /percent /ampersand /quoteright
  541.     /parenleft /parenright /asterisk /plus
  542.     /comma /hyphen /period /slash
  543.     /zero /one /two /three
  544.     /four /five /six /seven
  545.     /eight /nine /colon /semicolon
  546.     /less /equal /greater /question
  547. % \10x
  548.     /at /A /B /C /D /E /F /G
  549.     /H /I /J /K /L /M /N /O
  550.     /P /Q /R /S /T /U /V /W
  551.     /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
  552. % \14x
  553.     /quoteleft /a /b /c /d /e /f /g
  554.     /h /i /j /k /l /m /n /o
  555.     /p /q /r /s /t /u /v /w
  556.     /x /y /z /braceleft /bar /braceright /asciitilde /.notdef
  557. % \20x
  558.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  559.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  560.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  561.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  562. % \24x
  563.     /.notdef /exclamdown /cent /sterling
  564.     /fraction /yen /florin /section
  565.     /currency /quotesingle /quotedblleft /guillemotleft
  566.     /guilsinglleft /guilsinglright /fi /fl
  567.     /.notdef /endash /dagger /daggerdbl
  568.     /periodcentered /.notdef /paragraph /bullet
  569.     /quotesinglbase /quotedblbase /quotedblright /guillemotright
  570.     /ellipsis /perthousand /.notdef /questiondown
  571. % \30x
  572.     /.notdef /grave /acute /circumflex /tilde /macron /breve /dotaccent
  573.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  574.     /emdash /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  575.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  576. % \34x
  577.     /.notdef /AE /.notdef /ordfeminine /.notdef /.notdef /.notdef /.notdef
  578.     /Lslash /Oslash /OE /ordmasculine /.notdef /.notdef /.notdef /.notdef
  579.     /.notdef /ae /.notdef /.notdef /.notdef /dotlessi /.notdef /.notdef
  580.     /lslash /oslash /oe /germandbls /.notdef /.notdef /.notdef /.notdef
  581. 256 packedarray def
  582.  
  583. % Define the ISO Latin-1 encoding vector.
  584. % The first half is the same as the standard encoding.
  585. /ISOLatin1Encoding
  586. StandardEncoding 0 128 getinterval aload pop
  587. %*** NOTE: the following are missing in the Adobe documentation,
  588. %*** but appear in the displayed table:
  589. %*** macron at 225, dieresis at 230, cedilla at 233, space at 240.
  590. % \20x
  591.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  592.     /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
  593.     /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent
  594.     /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek /caron
  595. % \24x
  596.     /space /exclamdown /cent /sterling
  597.     /currency /yen /brokenbar /section
  598.     /dieresis /copyright /ordfeminine /guillemotleft
  599.     /logicalnot /hyphen /registered /macron
  600.     /degree /plusminus /twosuperior /threesuperior
  601.     /acute /mu /paragraph /periodcentered
  602.     /cedilla /onesuperior /ordmasculine /guillemotright
  603.     /onequarter /onehalf /threequarters /questiondown
  604. % \30x
  605.     /Agrave /Aacute /Acircumflex /Atilde
  606.     /Adieresis /Aring /AE /Ccedilla
  607.     /Egrave /Eacute /Ecircumflex /Edieresis
  608.     /Igrave /Iacute /Icircumflex /Idieresis
  609.     /Eth /Ntilde /Ograve /Oacute
  610.     /Ocircumflex /Otilde /Odieresis /multiply
  611.     /Oslash /Ugrave /Uacute /Ucircumflex
  612.     /Udieresis /Yacute /Thorn /germandbls
  613. % \34x
  614.     /agrave /aacute /acircumflex /atilde
  615.     /adieresis /aring /ae /ccedilla
  616.     /egrave /eacute /ecircumflex /edieresis
  617.     /igrave /iacute /icircumflex /idieresis
  618.     /eth /ntilde /ograve /oacute
  619.     /ocircumflex /otilde /odieresis /divide
  620.     /oslash /ugrave /uacute /ucircumflex
  621.     /udieresis /yacute /thorn /ydieresis
  622. 256 packedarray def
  623.  
  624. % Define a stub for the Symbol encoding.
  625. userdict begin
  626.   /SymbolEncoding
  627.    { userdict begin (sym__enc.ps) run /SymbolEncoding load end
  628.    } bind def
  629. end
  630.  
  631. (END FONTDIR/ENCS) VMDEBUG
  632.  
  633. % Construct a dictionary of all available devices.
  634. mark
  635.     % Loop until the getdevice gets a rangecheck.
  636.   0 { {dup getdevice exch 1 add} loop} stopped pop
  637.   dict /devicedict exch def
  638.   devicedict begin        % 2nd copy of count is on stack
  639.    { dup /Name gsgetdeviceprop cvn dup 3 -1 roll def
  640.      counttomark 1 roll
  641.    } repeat
  642.   end
  643. ] /devicenames exch def
  644. $error /newerror false put        % remove error indication
  645.  
  646. (END DEVS) VMDEBUG
  647.  
  648. % Define statusdict, for the benefit of programs
  649. % that think they are running on a LaserWriter or similar printer.
  650. (gs_statd.ps) run
  651.  
  652. (END STATD) VMDEBUG
  653.  
  654. % Load the standard font environment.
  655. (gs_fonts.ps) run
  656.  
  657. (END GS_FONTS) VMDEBUG
  658.  
  659. % Load the initialization files for optional features.
  660. systemdict /INITFILES known
  661.  { INITFILES { dup run VMDEBUG } forall
  662.  }
  663. if
  664.  
  665. % Create a null font.  This is the initial font.
  666. 7 dict dup begin
  667.   /FontMatrix [ 1 0 0 1 0 0 ] def
  668.   /FontType 3 def
  669.   /FontName () def
  670.   /Encoding StandardEncoding def
  671.   /FontBBox { 0 0 0 0 } def    % executable is bogus, but customary ...
  672.   /BuildChar { pop pop 0 0 setcharwidth } bind def
  673. end
  674. /NullFont exch definefont setfont
  675. % Define NullFont as the font, but remove it from FontDirectory.
  676. /NullFont currentfont def
  677. FontDirectory /NullFont undef
  678.  
  679. (END FONTS) VMDEBUG
  680.  
  681. % Restore the real definition of run.
  682. /run /.run load def
  683. currentdict /.run undef
  684.  
  685. % Bind all the operators defined as procedures.
  686. /bindoperators        % binds operators in currentdict
  687.  { % Temporarily disable the typecheck error.
  688.    errordict /typecheck get
  689.    errordict /typecheck { pop } put    % pop the command
  690.    currentdict
  691.     { dup type /operatortype eq
  692.        { % This might be a real operator, so bind might cause a typecheck,
  693.      % but we've made the error a no-op temporarily.
  694.      .bind        % do a real bind even if NOBIND is set
  695.        }
  696.       if pop pop
  697.     } forall
  698.    errordict /typecheck 3 -1 roll put
  699.  } def
  700. NOBIND not { bindoperators } if
  701.  
  702. % Define a procedure for skipping over an unneeded section of code.
  703. % This avoids allocating space for the skipped procedures.
  704. /.skipeof    % string ->
  705.  { { dup currentfile =string readline pop eq { exit } if } loop pop
  706.  } bind def
  707.  
  708. % Establish a default environment.
  709.      
  710. DISPLAYING not
  711.  { nulldevice (%END DISPLAYING) .skipeof
  712.  } if
  713. systemdict /DEVICE known
  714.  { devicedict DEVICE known not
  715.     { (Unknown device: ) print DEVICE =
  716.       flush 1 .quit
  717.     }
  718.    if
  719.  }
  720. if
  721. defaultdevice
  722. systemdict /DEVICEWIDTH known
  723. systemdict /DEVICEHEIGHT known or
  724. systemdict /DEVICEWIDTHPOINTS known or
  725. systemdict /DEVICEHEIGHTPOINTS known or
  726. systemdict /DEVICEXRESOLUTION known or
  727. systemdict /DEVICEYRESOLUTION known or
  728. systemdict /PAPERSIZE known or
  729. not { (%END DEVICE) .skipeof } if
  730. systemdict /PAPERSIZE known
  731.  {    % Convert the paper size to device dimensions.
  732.    true statusdict /.pagetypenames get
  733.     { PAPERSIZE eq
  734.        { PAPERSIZE load
  735.          dup 0 get /DEVICEWIDTHPOINTS exch def
  736.          1 get /DEVICEHEIGHTPOINTS exch def
  737.          pop false exit
  738.        }
  739.       if
  740.     }
  741.    forall
  742.     { (Unknown paper size: ) print PAPERSIZE ==only (.\n) print
  743.     }
  744.    if
  745.  }
  746. if
  747. % Adjust the device parameters per the command line.
  748.    getdeviceprops dicttomark begin
  749.    6 dict begin
  750.    /dw HWSize 0 get def
  751.    /dh HWSize 1 get def
  752.    /dmat InitialMatrix def
  753.    /dxres HWResolution 0 get def
  754.    /dyres HWResolution 1 get def
  755.    /DEVICEXRESOLUTION where
  756.     { pop /drq DEVICEXRESOLUTION dxres div def
  757.       0 2 4
  758.        { dup
  759.      dmat exch get drq mul
  760.      dmat 3 1 roll put
  761.        }
  762.       for
  763.       dw drq mul cvi /dw exch def
  764.       /dxres DEVICEXRESOLUTION def
  765.     }
  766.    if
  767.    /DEVICEYRESOLUTION where
  768.     { pop /drq DEVICEYRESOLUTION dyres div def
  769.       1 2 5
  770.        { dup
  771.          dmat exch get drq mul
  772.      dmat 3 1 roll put
  773.        }
  774.       for
  775.       dh drq mul cvi /dh exch def
  776.       /dyres DEVICEYRESOLUTION def
  777.      }
  778.    if
  779.     % Check for device sizes specified in pixels.
  780.    /DEVICEWIDTH where
  781.     { pop /dw DEVICEWIDTH def
  782.     }
  783.    if
  784.    /DEVICEHEIGHT where
  785.     { pop /dh DEVICEHEIGHT def
  786.     }
  787.    if
  788.     % Check for device sizes specified in points.
  789.    /DEVICEWIDTHPOINTS where
  790.     { pop /dw DEVICEWIDTHPOINTS dxres mul 72 div cvi def
  791.     }
  792.    if
  793.    /DEVICEHEIGHTPOINTS where
  794.     { pop /dh DEVICEHEIGHTPOINTS dyres mul 72 div cvi def
  795.     }
  796.    if
  797.    mark
  798.    /HWSize [ dw dh ] /HWResolution [ dxres dyres ] /InitialMatrix dmat
  799.    defaultdevice putdeviceprops
  800.    end end
  801. %END DEVICE
  802. mark
  803. systemdict /BufferSpace known
  804.  { /BufferSpace BufferSpace /MaxBitmap BufferSpace
  805.  } if
  806. systemdict /OutputFile known
  807.  { /OutputFile OutputFile
  808.  } if
  809. counttomark dup 0 ne
  810.  { 2 add -1 roll putdeviceprops }
  811.  { pop pop }
  812. ifelse
  813. setdevice        % does an erasepage
  814. %END DISPLAYING
  815.  
  816. 1 setflat        % initgraphics doesn't set this
  817.  
  818. (END DEVICE) VMDEBUG
  819.  
  820. % Establish a default upper limit in the character cache,
  821. % namely, enough room for a 1/4" x 1/4" character at the resolution
  822. % of the default device.
  823. mark
  824.   18 18 dtransform        % 1/4" x 1/4"
  825.   exch abs cvi 31 add 32 idiv 4 mul    % X raster
  826.   exch abs cvi mul        % Y
  827.   dup 10 idiv exch
  828. setcacheparams
  829. % Conditionally disable the character cache.
  830. NOCACHE { 1 setcachelimit } if
  831.     
  832. (END CONFIG) VMDEBUG
  833.  
  834. % Establish an appropriate halftone screen.
  835.  
  836. 72 72 dtransform abs exch abs min    % min(|dpi x|,|dpi y|)
  837. dup 150 lt systemdict /DITHERPPI known not and
  838.  {        % Low-res device, use ordered dither spot function
  839.     % The following 'ordered dither' spot function was contributed by
  840.     % Gregg Townsend.  Thanks, Gregg!
  841.   16.001 div 0            % not 16: avoids rounding problems
  842.    { 1 add 7.9999 mul cvi exch 1 add 7.9999 mul cvi 16 mul add <
  843.     0E 8E 2E AE 06 86 26 A6 0C 8C 2C AC 04 84 24 A4
  844.     CE 4E EE 6E C6 46 E6 66 CC 4C EC 6C C4 44 E4 64
  845.     3E BE 1E 9E 36 B6 16 96 3C BC 1C 9C 34 B4 14 94
  846.     FE 7E DE 5E F6 76 D6 56 FC 7C DC 5C F4 74 D4 54
  847.     01 81 21 A1 09 89 29 A9 03 83 23 A3 0B 8B 2B AB
  848.     C1 41 E1 61 C9 49 E9 69 C3 43 E3 63 CB 4B EB 6B
  849.     31 B1 11 91 39 B9 19 99 33 B3 13 93 3B BB 1B 9B
  850.     F1 71 D1 51 F9 79 D9 59 F3 73 D3 53 FB 7B DB 5B
  851.     0D 8D 2D AD 05 85 25 A5 0F 8F 2F AF 07 87 27 A7
  852.     CD 4D ED 6D C5 45 E5 65 CF 4F EF 6F C7 47 E7 67
  853.     3D BD 1D 9D 35 B5 15 95 3F BF 1F 9F 37 B7 17 97
  854.     FD 7D DD 5D F5 75 D5 55 FF 7F DF 5F F7 77 D7 57
  855.     02 82 22 A2 0A 8A 2A AA 00 80 20 A0 08 88 28 A8
  856.     C2 42 E2 62 CA 4A EA 6A C0 40 E0 60 C8 48 E8 68
  857.     32 B2 12 92 3A BA 1A 9A 30 B0 10 90 38 B8 18 98
  858.     F2 72 D2 52 FA 7A DA 5A F0 70 D0 50 F8 78 D8 58
  859.    > exch get 256 div }        % screen
  860.   { }        % transfer
  861.   true        % strokeadjust
  862.  }
  863.  {        % Hi-res device, use 45 degree dot spot function.
  864.     % 46 seems to be a good frequency value for printers
  865.     % between 200 and 400 DPI.  We set the frequency low enough
  866.     % that we can be guaranteed at least a 4x4 pixel cell.
  867.    systemdict /DITHERPPI known { DITHERPPI } { 46 } ifelse
  868.    exch 4.01 div min
  869.    45
  870.     { dup mul exch dup mul add 1 exch sub
  871.     }        % screen
  872.     % Set the transfer function to lighten up the grays.
  873.     % We correct at the high end so that very light grays
  874.     % don't disappear completely if they darken <1 screen pixel.
  875.    { sqrt dup dup 0.9375 gt exch 1 lt and    % > 15/16
  876.       { currentscreen pop pop
  877.         gsave initmatrix 72 exch div dup dtransform grestore
  878.     cvi exch cvi mul abs        % # of pixels in halftone cell
  879.     1 sub                % tweak to avoid boundary
  880.     1 exch div 1 exch sub min
  881.       }
  882.      if
  883.    }
  884.    false    % strokeadjust
  885.  }
  886. ifelse
  887.   5 -3 roll bind setscreen
  888.   exch settransfer
  889.   setstrokeadjust
  890. initgraphics
  891. % The interpreter relies on there being at least 2 entries
  892. % on the graphics stack.  Establish the second one now.
  893. gsave
  894.  
  895. % Define control-D as a no-op.  This is a hack to get around problems
  896. % in some common PostScript-generating applications.
  897. (\004) cvn { } def
  898. (\004\004) cvn { } def
  899.  
  900. % Turn off array packing for interactive use.
  901. false setpacking
  902.  
  903. % Close up systemdict.
  904. end
  905. WRITESYSTEMDICT not { systemdict readonly pop } if
  906.  
  907. (END INIT) VMDEBUG
  908.  
  909. QUIET not { (done.\n) print flush } if
  910.  
  911. % The interpreter will run the initial procedure (start).
  912.